<style>
@media print {
  ._wz_deptParameterDetails {
    height: inherit !important;
    -webkit-print-color-adjust: exact;
    font-size: 12px !important;
  }
}
</style>
<template>
  <div class="_wz_deptParameterDetails" ref="printContents">
    <table cellpadding="0" cellspacing="0" border="0">
      <colgroup>
        <col width="13%">
        <col width="20%">
        <col width="13%">
        <col width="20%">
        <col width="13%">
        <col width="20%">
      </colgroup>
      <tbody>
      <tr>
        <td style="font-weight: 600;position:relative;text-align: center;font-size: 18px;" colspan="6">{{!!formData.deptName ? formData.deptName : '--'}} 企业档案</td>
      </tr>
      <tr>
        <td colspan="2" rowspan="4">
          <div class="demo-upload-list">
            <div style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
              <Image :src="!!formData.deptPic ? apiUrl.imgUrl + formData.deptPic : 'img/zwtpxd.png'" fit="contain" width=100% height=100% preview :preview-list="[!!formData.deptPic ? apiUrl.imgUrl + formData.deptPic:'img/zwtpxd.png']" />
            </div>
          </div>
        </td>
        <td style="text-align: right;font-weight: 600;">经营企业</td>
        <td colspan="3">{{!!formData.deptName ? formData.deptName : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">法人姓名</td>
        <td>{{!!formData.legalPerson ? formData.legalPerson : '--'}}</td>
        <td style="text-align: right;font-weight: 600;">企业类型</td>
        <td>{{!!formData.transportValue ? formData.transportValue : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">联系人</td>
        <td>{{!!formData.contact ? formData.contact : '--'}}</td>
        <td style="text-align: right;font-weight: 600;">联系电话</td>
        <td>{{!!formData.phone ? formData.phone : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">企业负责人</td>
        <td>{{!!formData.personCharge ? formData.personCharge : '--'}}</td>
        <td style="text-align: right;font-weight: 600;">负责人电话</td>
        <td>{{!!formData.personChargePhone ? formData.personChargePhone : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">行政区域</td>
        <td>{{!!formData.provinceCode?formData.provinceName+' '+formData.cityName+' '+formData.countyName:''}}</td>
        <td style="text-align: right;font-weight: 600;">企业邮箱</td>
        <td>{{!!formData.email ? formData.email : '--'}}</td>
        <td style="text-align: right;font-weight: 600;">企业地址</td>
        <td>{{!!formData.address ? formData.address : '--'}}</td>
      </tr>
      <tr>
        <td style="text-align: center;font-weight: 600;" colspan="3">营业执照</td>
        <td style="text-align: center;font-weight: 600;" colspan="3">经营许可证</td>
      </tr>
      <tr>
        <td  colspan="3">
          <div class="demo-upload-list">
            <div style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
               <Image :src="!!formData.uniformSocialCreditImg ? apiUrl.imgUrl + formData.uniformSocialCreditImg : 'img/zwtpxd.png'" fit="contain" width=100% height=100% preview :preview-list="[!!formData.uniformSocialCreditImg ? apiUrl.imgUrl + formData.uniformSocialCreditImg:'img/zwtpxd.png']" />
            </div>
          </div>
          <div style="text-align: center;line-height: 30px;">{{!!formData.uniformSocialCreditCode?formData.uniformSocialCreditCode:'--'}}</div>
        </td>
        <td  colspan="3">
          <div class="demo-upload-list">
            <div style="width: 100%;height: 100%; display: flex;align-items: center;justify-content: center;">
               <Image :src="!!formData.transportBusinessLicenseImg ? apiUrl.imgUrl + formData.transportBusinessLicenseImg : 'img/zwtpxd.png'" fit="contain" width=100% height=100% preview :preview-list="[!!formData.transportBusinessLicenseImg ? apiUrl.imgUrl + formData.transportBusinessLicenseImg:'img/zwtpxd.png']" />
            </div>
          </div>
          <div style="text-align: center;line-height: 30px;">{{!!formData.transportBusinessLicenseCode?formData.transportBusinessLicenseCode:'--'}}</div>
        </td>
      </tr>
      </tbody>
    </table>
    <Spin size="large" fix v-if="spinShow"></Spin>
  </div>
</template>
<script>


import {getCurrentInstance,inject,nextTick,reactive, toRefs,toRef,onBeforeMount,onMounted,onBeforeUpdate,onUpdated,onBeforeUnmount,onUnmounted, ref,defineComponent,toRaw,watch} from 'vue'
import { useRouter,useRoute } from "vue-router";

import { useMainStore } from '../../store'  //pinia 使用 类似 vuex
import { storeToRefs } from 'pinia'//pinia 使用 类似 vuex
const mainStore = useMainStore() //pinia 使用 类似 vuex



//reactive
export default defineComponent({
  name: 'deptParameterDetails',//组件名称
  props: ['selectData'],//接收来自父组件的数据
  components: {},//组件引用
  setup (props,context) {


    const apiUrl = inject('$apiUrl'); // 变量全局化 后台地址
    const $axios = inject('$axiosInterceptor');// 变量全局化 axios
    const $ViewUIPlus = inject('$ViewUIPlus');//引用全局组件
    const router = useRouter();//路由跳转使用


    // 用于获取$refs
    const printContents = ref();


    const state = reactive({
      spinShow:false,
      formData:{},
    });

    //加载数据
    const loadData = ()=>{
      $axios.post(apiUrl.coreDeptCoreDeptInfo,{uuid:props.selectData.uuid}).then((res) => {
        if(!!res){
          state.formData = res.data.data;
        }
      }).catch((err) => {
        console.log("失败", err)
      })


    }



    // 其他的生命周期
    onBeforeMount (() => {//beforeMount挂载前状态 // console.log("App ===> 相当于 vue2.x 中 beforeMount")

    })
    onMounted (() => {//mounted 挂载结束状态  // console.log("App ===> 相当于 vue2.x 中 mounted")
      loadData();

    })

    // 注意，onBeforeUpdate 和 onUpdated
    // 里面不要修改值
    onBeforeUpdate (() => {//beforeUpdate 更新前状态 // console.log("App ===> 相当于 vue2.x 中 beforeUpdate")

    })

    onUpdated (() => {//updated 更新完成状态 // console.log("App ===> 相当于 vue2.x 中 updated")

    })

    onBeforeUnmount (() => {//beforeDestroy 销毁前状态  // console.log("App ===> 相当于 vue2.x 中 beforeDestroy")
    })

    onUnmounted (() => {//destroyed 销毁完成状态  // console.log("App ===> 相当于 vue2.x 中 destroyed")
    })

    return {
      ...toRefs(state),
      apiUrl,
      printContents,//打印内容 ref
    }
  }
})


</script>
<style lang="less">
._wz_deptParameterDetails{
  table {
    table-layout:fixed;
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 12px !important;

    td {
      min-width: 0;
      height: 40px;
      box-sizing: border-box;
      text-align: left;
      text-overflow: ellipsis;
      border: 1px solid #515a6e;
      padding: 0 10px;
      word-break: break-word;
      ._wz_insertimage {
        display: inline-block;
        width: 200px;
        height: 140px;
        text-align: center;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
        position: relative;
        border: 1px solid rgba(0, 0, 0, .2);
        margin-right: 4px;

        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
}
</style>

